home *** CD-ROM | disk | FTP | other *** search
- Path: Rosie.UH.EDU!ST7JR
- From: st7jr@Rosie.UH.EDU (odie garfield)
- Newsgroups: comp.lang.c
- Subject: Help: 2 short functions
- Date: 30 Mar 1996 02:42:44 GMT
- Organization: University of Houston
- Message-ID: <4ji734$n6v@masala.cc.uh.edu>
- Reply-To: st7jr@Rosie.UH.EDU
- NNTP-Posting-Host: rosie.uh.edu
-
- Hi, I have two functions that I'm not too sure about.
- The first one:
-
- char *get_filename(void)
- {
- char string[20],*stringp;
- scanf("%s",string);
- stringp=&string[0];
- return stringp;
- }
- I'm want the function to read in a string and return a pointer to that string.
- Am I doing it correctly?
-
- My second function is related to the first function:
-
- FILE *open_file(char *filenamep)
- {
- FILE *fp;
- fp=fopen("??????","r");
- return fp;
- }
- In this 2nd function, I want to open a file using the pointer to a string I
- got from the first function. But I don't know exactly how to do this. Any help
- would be appreciated. Thanks.
-
-